package com.ch.home.bean;

import java.util.Date;

/**
 * 订单记录
 * Created by CHEN on 2019/8/25.
 * OK
 */
public class CommodityRecord {

    private Integer id;
    private Integer userId;
    private Integer commodityId;
    private Date time;
    private Integer sum;
    private Integer num;

    public CommodityRecord() {
    }

    public CommodityRecord(Integer id, Integer userId, Integer commodityId, Date time, Integer sum, Integer num) {
        this.id = id;
        this.userId = userId;
        this.commodityId = commodityId;
        this.time = time;
        this.sum = sum;
        this.num = num;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getCommodityId() {
        return commodityId;
    }

    public void setCommodityId(Integer commodityId) {
        this.commodityId = commodityId;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public Integer getSum() {
        return sum;
    }

    public void setSum(Integer sum) {
        this.sum = sum;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    @Override
    public boolean equals(Object o) {

        if (this == o) return true;
        if (o == null || getClass( ) != o.getClass( )) return false;

        CommodityRecord that = (CommodityRecord) o;

        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (userId != null ? !userId.equals(that.userId) : that.userId != null) return false;
        if (commodityId != null ? !commodityId.equals(that.commodityId) : that.commodityId != null) return false;
        if (time != null ? !time.equals(that.time) : that.time != null) return false;
        if (sum != null ? !sum.equals(that.sum) : that.sum != null) return false;
        return num != null ? num.equals(that.num) : that.num == null;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode( ) : 0;
        result = 31 * result + (userId != null ? userId.hashCode( ) : 0);
        result = 31 * result + (commodityId != null ? commodityId.hashCode( ) : 0);
        result = 31 * result + (time != null ? time.hashCode( ) : 0);
        result = 31 * result + (sum != null ? sum.hashCode( ) : 0);
        result = 31 * result + (num != null ? num.hashCode( ) : 0);
        return result;
    }

    @Override
    public String toString() {
        return "CommodityRecord{" +
                "id=" + id +
                ", userId=" + userId +
                ", commodityId=" + commodityId +
                ", time=" + time +
                ", sum=" + sum +
                ", num=" + num +
                '}';
    }
}
